﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using WaitLess.Business.Data.Foursquare;
using WaitLess.Business.Data.Foursquare.Interfaces;
using WaitLess.Business.Data.Model.Foursquare.HereNowResponse;
using WaitLess.Business.Data.Model.Foursquare.VenuesResponse;
using WaitLess.Business.Data.Web;
using WaitLess.Business.Data.Web.Interfaces;
using WaitLess.Business.Repositories;
using WaitLess.Business.Repositories.Interfaces;
using WaitLess.Business.Tests.Common;

namespace WaitLess.Business.Tests.Integration.Repositories.VenuesRepositorySpecifications
{
    [TestClass]
    public class WhenGetHereNow : AsyncTestBase
    {
        protected IVenuesRepository VenuesRepository { get; private set; }
        protected IWebRequestor WebRequestor { get; private set; }
        protected IFoursquareContext FoursquareContext { get; private set; }

        protected string VenueId { get; set; }
        protected string AccessToken { get; set; }

        protected HereNowResponse Result { get; set; }

        protected override void Arrange()
        {
            base.Arrange();
            WebRequestor = new WebRequestor();
            FoursquareContext = new FoursquareContext(WebRequestor);
            VenuesRepository = new VenuesRepository(FoursquareContext);

            VenueId = "4bdc94e803be20a1adaa849b"; //https://foursquare.com/v/caf%C3%A9-pick/4bdc94e803be20a1adaa849b
            AccessToken = "VXBBQRYJANHU4PEP1AOJVRBR4DEDPX3TG41XXEJ1NBHAAZ1I";
        }

        protected override void Act()
        {
            VenuesRepository.GetHereNow(VenueId, AccessToken, result =>
            {
                Result = result;
                IsActCompleted = true;
            });
        }

        [TestMethod]
        public void ThenResultShouldNotBeEmpty()
        {
            Assert.IsNotNull(Result);
            Assert.IsNotNull(Result.response.hereNow.count);
        }
    }
}
